<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="cn.school.util.StringKit"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@page import="cn.school.service.*,cn.school.dao.*,cn.school.entity.*,java.util.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>学生信息</title>
<script type="text/javascript" src="js/jquery-3.2.0.js"></script>
</head>
<body>
<%@include file="newcheckLogin.jsp" %>
<%-- <div>
 <%
   Object o=session.getAttribute("USER_LOGIN");
   if(o==null){
	   out.print("<script>alert('你丫的是翻窗户进来的？');location.replace('login.jsp');</script>");
	   return;
   }
 %>
 <h1>欢迎你，<%=o%>, <a href="logout.jsp">退出</a></h1>
</div> --%>
<%-- <p>
 <%
 String name=request.getParameter("studentname");
 %>
 您刚才注册的姓名是<%=name%>
</p> --%>
<%-- <%
/* String sname=StringKit.converNull(request.getParameter("sname"));
String telephone=StringKit.converNull(request.getParameter("telephone"));
String qq=StringKit.converNull(request.getParameter("qq"));
String enterdatestart=StringKit.converNull(request.getParameter("enterdatestart"));
Date enterdatestart1=StringKit.toDate(request.getParameter("enterdatestart"));
/* SimpleDateFormat sim=new SimpleDateFormat("yyyy-MM-dd"); */

Service service=new Service();
int pageno=1;
try{
	 pageno=Integer.parseInt(request.getParameter("pageno"));
}catch(Exception e){}

List<Student> list=service.searchLimitByMohu(pageno, 10,sname,telephone,qq,enterdatestart1);
int total=service.searchTotal(sname, telephone,qq,enterdatestart1);
out.print(total);
int pageTotal=total/10+(total%10==0?0:1); 
%>  --%> 
<p>
<form method="get" action="StudentLimitServlet">
 <input type="search" name="sname" value="${sname }" placeholder="用户名"/>
 <input type="search" name="telephone" value="${telephone }" placeholder="手机号"/> 
 <input type="search" name="qq" value="${qq }" placeholder="QQ号"/> 
 <input type="search" name="enterdatestart" value="${enterdatestart }" placeholder="入学日期起点"/> 
 <input type="submit" value="search"/>
 </form>
</p>
<a href="student2.jsp">增加新生</a>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td>学号</td><td>姓名</td><td>性别</td><td>电话</td><td>QQ号</td><td>微信</td><td>年级编号</td>
<td>入学日期</td>
<td>来自哪里</td><td>出生日期</td><td>地址</td><td>密码</td><td>照片</td><td>操作</td>
</tr>
<%-- <%
 for(Student s:list){
%> --%>
<c:forEach items="${list}" var="student" >
 <tr>
  <td>${student.stuno }</td><td>${student.sname }</td> <td>${student.sex }</td><td>${student.telephone }</td>
	<td>${student.qq }</td><td>${student.wechat }</td><td>${student.gradeid }</td>
	<td>${StringKit.dateToString(student.enterdate) }</td>
	<td>${student.fromcity }</td>
	<td>${StringKit.dateToString(student.birthday) }</td>
	<td>${student.address }</td>
	<td>${student.pass }</td>
	<td>${student.idcardpic }</td>
  <td>
  	<a onclick="return window.confirm('真的要删除？')" href="StudentDeleteServlet?stuno=${student.stuno }">删除</a>
 	&nbsp;
 	<a  href="UpdateStudentServlet2?stuno=${student.stuno }">修改</a>
  </td>
 </tr>
<<%-- %} %> --%>
</c:forEach>
</table>
<p align="center">
 <a href="StudentLimitServlet?pageno=1&sname=${sname }&telephone=${telephone }&qq=${qq }&enterdatestart=${enterdatestart}">首页</a>
<%-- <%
  if(pageno>1){    
%> --%>

<c:if test="${pageno>1 }">
 <a href="StudentLimitServlet?pageno=${pageno-1 }&sname=${sname }&telephone=${telephone }&qq=${qq }&enterdatestart=${enterdatestart}">上一页</a>
<%--  <%} %> --%>
</c:if>
 <input type="number" min="1" name="go" style="width:30px" value="${pageno }"/>/${pageTotal }
 <%-- <%
  if(pageTotal>pageno){
 %> --%>
 
 <c:if test="${pageTotal>pageno }">
 <a href="StudentLimitServlet?pageno=${pageno+1 }&sname=${sname }&telephone=${telephone }&qq=${qq }&enterdatestart=${enterdatestart}">下一页</a>
<%--  <%} %> --%>
</c:if>
 <a href="StudentLimitServlet?pageno=${pageTotal }&sname=${sname }&telephone=${telephone }&qq=${qq }&enterdatestart=${enterdatestart}">末页</a>
</p>
</body>
<script>
$(function(){
	 $("input[name=go]").keydown(function(event){
		
		 if(event.keyCode==13)//回车
		 {
			 if(this.value==""||isNaN(this.value)){
				 return false;
			 } 
			 window.location="StudentLimitServlet?pageno="+$(this).val()+"&sname=${sname }&telephone=${telephone }&qq=${qq }&enterdatestart=${enterdatestart}";

		 }
	 }).blur(function(){
		 if(this.value==""||isNaN(this.value)){
			 return false;
		 } 
		 window.location="StudentLimitServlet?pageno="+$(this).val()+"&sname=${sname }&telephone=${telephone }&qq=${qq }&enterdatestart=${enterdatestart}";
	 });
});
</script>
</html>